import {request} from 'st-common-req'
import type {DictType} from '../types/dict-type.ts'

/**
 * 获取字典列表
 */
export const getDicts = (params?: Record<string, any>) => request<DictType[]>({
  url: '/api/sys/dict/list',
  method: 'GET',
  params,
})

/**
 * 新增字典
 */
export const addDict = (data: DictType) => request({
  url: '/api/sys/dict/add',
  method: 'POST',
  data,
})

/**
 * 更新字典
 */
export const updateDict = (data: DictType) => request({
  url: '/api/sys/dict/update',
  method: 'PUT',
  data,
})

/**
 * 删除字典
 */
export const deleteDict = (id: string) => request({
  url: `/api/sys/dict/delete/${id}`,
  method: 'DELETE',
}) 